#!/bin/sh

. $LKP_SRC/lib/http.sh

if [ -z "$vmlinux_file" ]; then
	echo "No vmlinux_file in job file" 1>&2
	exit 1
fi

modules_dir="/lib/modules/$(uname -r)"

[ -d "$modules_dir/build" ] && exit 0

KBUILD_DIR=/lkp/kbuild

mkdir -p "$KBUILD_DIR"

http_get_file "$vmlinux_file" "$KBUILD_DIR/vmlinux"

mkdir -p "$modules_dir"
ln -sf "$KBUILD_DIR" "$modules_dir/build"
